package com.shensi.api.admin.client.coupon;

import com.shensi.api.admin.client.fallback.coupon.CouponInfoClientFallBack;
import com.shensi.api.admin.domian.coupon.dto.CouponInfoDto;
import com.shensi.common.core.constant.CloudConstant;
import com.shensi.common.core.domain.AjaxResult;
import com.shensi.common.core.page.TableDataInfo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.cloud.openfeign.SpringQueryMap;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;

/**
 * @author: budian
 * @since: 2023/11/30
 */
@FeignClient(
        value = CloudConstant.ADMIN_SERVER,
        fallbackFactory = CouponInfoClientFallBack.class)
@Component
public interface CouponInfoClient {

    /**
     * 查询优惠劵列表
     */
    @GetMapping("/coupon/info/list")
    public TableDataInfo list(@SpringQueryMap CouponInfoDto couponInfo);

    /**
     * 查询优惠卷启用状态
     */
    @GetMapping("/coupon/info/selectCouponEnableFalge")
    public AjaxResult selectCouponEnableFalge();

    /**
     * 导出优惠劵列表
     */
    @GetMapping("/coupon/info/export")
    public AjaxResult export(@SpringQueryMap CouponInfoDto couponInfo);

    /**
     * 获取优惠劵详细信息
     */
    @GetMapping(value = "/coupon/info/{id}")
    public AjaxResult getInfo(@PathVariable("id") Integer id);

    /**
     * 新增优惠劵
     */
    @PostMapping("/coupon/info")
    public AjaxResult add(@RequestBody CouponInfoDto couponInfo);

    /**
     * 修改优惠劵
     */
    @PutMapping("/coupon/info")
    public AjaxResult edit(@RequestBody CouponInfoDto couponInfo);

    /**
     * 删除优惠劵
     */
    @DeleteMapping("/coupon/info/{ids}")
    public AjaxResult remove(@PathVariable("ids") Integer[] ids);

}
